![]() |
PATH![]() |
Each applet has one or more frames associated with it. A frame is analogous to a Mac OS window record and usually represents a user window. The following functions let you pass events between a visible user window and the abstract applet frame.
Assigns Mac OS window visibility properties to a frame.
OSStatus JMSetFrameVisibility (
JMFrameRef frame,
GrafPtr framePort,
Point frameOrigin,
const RgnHandle frameClip);
You use the JMSetFrameVisibility function to pass Mac OS window visibility elements to the abstract frame. For example, if the user moves the window associated with the frame (by dragging or scrolling), you must update the frame's visibility by passing the new position of the frame in JMSetFrameVisibility .
Reads client data associated with a frame.
OSStatus JMGetFrameData (
JMFrameRef frame,
JMClientData* data);
JMSetFrameData
function.Sets or changes the client data for a frame.
OSStatus JMSetFrameData (
JMFrameRef frame,
JMClientData data);
JMSetFrameData
function.Gets the coordinates of the frame.
OSStatus JMGetFrameSize (
JMFrameRef frame,
Rect* result);
Frames are described using a zero-based coordinate system with the top-left corner of the frame having the coordinates (0,0).
The
JMSetFrameSize
function.
OSStatus JMSetFrameSize (
JMFrameRef frame,
const Rect* newSize);
The function automatically calculates the width and height of the frame, given the coordinates you pass in the newSize parameter. The top left corner indicates the global position of this frame, so you can use this to update the position of the frame if it gets moved.
IMPORTANT
On the Mac OS platform, the global frame coordinates (0,0) does not map to the actual top left corner of the screen, but rather is offset to accomodate the title and side bars of the corresponding window as well as the menu bar.
JMGetFrameSize
function.Dispatches a mouse event to a frame.
OSStatus JMFrameClick (
JMFrameRef frame,
Point localPos,
short modifiers);
Dispatches a mouse event to a frame including event record information.
OSStatus JMFrameClickWithEventRecord (
JMFrameRef frame,
Point localPos,
const EventRecord* event);
Unlike
JMFrameClick
,
JMFrameClickWithEventRecord
passes the event record describing the mouse event.
Dispatches a key-down event to a frame.
OSStatus JMFrameKey (JMFrameRef frame,
char asciiChar,
char keyCode,
short modifiers);
The
JMFrameKeyRelease
function.
Dispatches a key-up event to a frame.
OSStatus JMFrameKeyRelease (JMFrameRef frame,
char asciiChar,
char keyCode,
short modifiers);
The
JMFrameKey
function.
OSStatus JMFrameUpdate (
JMFrameRef frame,
const RgnHandle updateRgn);
The region to update must be specified in frame coordinates, where the top-left corner of the frame has the coordinates (0,0).
Update, Activate, and Resume Events.
Activates or deactivates a frame.
OSStatus JMFrameActivate (
JMFrameRef frame,
Boolean activate);
Only one frame should be active at one time, so if you make a frame active, deactivate the other frames in that AWT context thread. The client application must keep track of the currently active frame.
Update, Activate, and Resume Events.
Passes a resume event to a frame.
OSStatus JMFrameResume (
JMFrameRef frame,
Boolean resume);
The resume event means that the frame becomes part of the running foreground process. When a client application receives a resume event, it must notify all its associated frames.
Update, Activate, and Resume Events.
Passes a mouse-over event to a frame.
OSStatus JMFrameMouseOver (
JMFrameRef frame,
Point localPos,
short modifiers);
To monitor the position of the mouse, you should call the
JMFrameMouseOver
and
JMIdle
functions each time through the event loop. Note that the client application must keep track of the currently active frame.
OSStatus JMFrameShowHide (
JMFrameRef frame,
Boolean showFrame);
Passes a go-away event to the frame.
OSStatus JMFrameGoAway (JMFrameRef frame);
Calling the JMFrameGoAway function disposes of the frame, although in some instances the Java program may want to display a dialog box message (asking if the user wants to save the file before closing, for example).
Passes mouse dragging information to a frame.
The JMFrameDragTracking function passes drag information to the frame when the user drags an item into the corresponding window. Essentially your application calls this function as though the Drag Manager were calling a DragTrackingHandler callback.
Note that JDK versions 1.1.x and earlier do not support drag and drop.
Drag Manager Programmer's Guide.
Passes a drag-and-drop item to a frame.
If the user releases a drag in a window corresponding to a frame, you should pass the drag information to the frame using JMFrameDragReceive . The frame can then take action on the drag, depending on the contents of the drag. Essentially your application calls this function as though the Drag Manager were calling a DragReceiveHandler callback.
Note that JDK versions 1.1.x and earlier do not support drag and drop.
Drag Manager Programmer's Guide.
Returns the AWT context associated with a frame.
JMAWTContextRef JMGetFrameContext (JMFrameRef frame);
Returns a JNI reference to a frame's Java object.
extern jobject JMGetAWTFrameJNIObject (
JMFrameRef frame,
JNIEnv * env);
Returns a JRI reference to a frame's Java object.
jref JMGetAWTFrameObject(JMFrameRef frame);
Note that unless you specifically need to use the Java Runtime Interface (JRI), you should use the
JMGetJMFrameJNIObject
function instead.
Returns a JNI reference to a frame's JMFrame object.
extern jobject JMGetJMFrameJNIObject (
JMFrameRef frame,
JNIEnv * env);
The JMGetJMFrameObject function returns the Java equivalent of a JMFrameRef reference. A JMFrameRef object encapsulates a Java frame object (that is, a java.awt.Frame object) so it can be handled outside the Java environment.
Returns a JRI reference to a frame's JMFrame object.
jref JMGetJMFrameObject(JMFrameRef frame);
The JMGetJMFrameObject function returns the Java equivalent of a JMFrameRef reference. A JMFrameRef object encapsulates a Java frame object (that is, a java.awt.Frame object) so it can be handled outside the Java environment.
Note that unless you explicitly need to use the Java Runtime Interface (JRI), you should use the
JMGetJMFrameJNIObject
function instead.